﻿Imports System.Data.OleDb
Public Class Register1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub BtAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtAdd.Click
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("Outletsdb").ConnectionString)


        oleDbConn.Open()
        Dim cmdQuery As String
        cmdQuery = "insert into Users ([Password],Username,Email)" &
            " VALUES('" & TxPassword.Text.ToString().Replace("'", "''") & "','" & TxUsername.Text.ToString().Replace("'", "''") & "','" & TxEmail.Text.ToString().Replace("'", "''") & "')"

        Dim dbcomm = New OleDbCommand(cmdQuery, oleDbConn)
        If dbcomm.ExecuteNonQuery() > 0 Then
            LbResult.Text = "Your account have been created successfully!"
        End If

        oleDbConn.Close()
    End Sub
End Class